<div class="doc-item" id="doc-841"><h2 class="doc-item-name">execute-format<span class="namespace">(clojure.contrib.pprint)</span></h2><ul class="var-arglists"><li>(<span class="var-name">execute-format</span> stream format args)</li><li>(<span class="var-name">execute-format</span> format args)</li></ul><div class="var-docstring"><p>Executes the format with the arguments. This should never be used directly, but is public
because the formatter macro uses it.</p></div><div class="var-source"><pre>; clojure/contrib/pprint/cl-format.clj:1758
(defn execute-format 
  ([stream format args]
     (let [#^java.io.Writer real-stream (cond 
                                         (not stream) (java.io.StringWriter.)
                                         (true? stream) *out*
                                         :else stream)
           #^java.io.Writer wrapped-stream (if (and (needs-pretty format) 
                                                    (not (instance? PrettyWriter real-stream)))
                                             (pretty-writer real-stream)
                                             real-stream)]
       (binding [*out* wrapped-stream]
         (try
          (execute-format format args)
          (finally
           (if-not (identical? real-stream wrapped-stream)
             (.flush wrapped-stream))))
         (if (not stream) (.toString real-stream)))))
  ([format args]
     (map-passing-context 
      (fn [element context]
        (if (abort? context)
          [nil context]
          (let [[params args] (realize-parameter-list 
                               (:params element) context)
                [params offsets] (unzip-map params)
                params (assoc params :base-args args)]
            [nil (apply (:func element) [params args offsets])])))
      args
      format)))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, which can be found in the file
          epl-v10.html at the root of this distribution. By using this software
          in any fashion, you are agreeing to be bound by the terms of this
          license. You must not remove this notice, or any other, from this
          software.</p></div></div>